﻿using Code;
using HeerCards;
using HeerCards.Info;
using LitJson;
using PropertyChanged;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace github.heerheer.card2.UI.ViewModels
{
    [AddINotifyPropertyChangedInterface]
    public class CardEditorViewModel : INotifyPropertyChanged
    {
        public HCPool Pool { get; set; }
        public HCLevel Level { get; set; }
        public VIPInfo ProInfo { get; set; } = AppMain.VipInfo;

        public event PropertyChangedEventHandler PropertyChanged;

        public void LoadLevelContent(string pool,string levelName)
        {
            this.Pool = JsonMapper.ToObject<HCPool>(File.ReadAllText(App.getPoolPath(pool)));
            this.Level = this.Pool.LevelCollections.Find(s => s.Name == levelName);
        }

    }
}
